from django.http import HttpResponse
from django.shortcuts import render

# Create your views here.
from goods.models import Goods


def detail(request, id):
    goods = Goods.objects.filter(id=id).first()
    new_goods = Goods.objects.filter(type=goods.type).all()
    new_goods = new_goods.exclude(id=id).all()[0:2]
    content = {
        'goods': goods,
        'new_goods': new_goods,
    }
    return render(request, 'detail.html', content)

